Skip to content

Default to anchors and remove automatic channel acceptance#4354

Open
elnosh wants to merge 4 commits intolightningdevkit:mainfrom
elnosh:manual-channel-acceptance
Open

Default to anchors and remove automatic channel acceptance#4354
elnosh wants to merge 4 commits intolightningdevkit:mainfrom
elnosh:manual-channel-acceptance

Conversation

@elnosh
Copy link
Contributor

@elnosh elnosh commented Jan 27, 2026

Closes #4337

Changes negotiate_anchors_zero_fee_htlc_tx default to true and removes the manually_accept_inbound_channels config option.

Edit: Left the tests with default to non-anchor

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Jan 27, 2026

👋 I see @jkczyz was un-assigned.
If you'd like another reviewer assignment, please click here.

@TheBlueMatt
Copy link
Collaborator

Changing the negotiate_anchors_zero_fee_htlc_tx default to true in the tests causes +100 test failures

Hmm, can you ask claude to change those to use the test_default_config() thing? Our test config default has diverged somewhat from our actual default config for reasons like this but that's okay...

@elnosh elnosh force-pushed the manual-channel-acceptance branch 2 times, most recently from ef441ac to b1ee9e3 Compare January 28, 2026 20:38
@elnosh elnosh marked this pull request as ready for review January 28, 2026 20:38
@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

❌ Patch coverage is 85.05747% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.02%. Comparing base (f43803d) to head (306eea7).
⚠️ Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/ln/channelmanager.rs 70.73% 11 Missing and 1 partial ⚠️
lightning/src/ln/functional_test_utils.rs 94.73% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4354   +/-   ##
=======================================
  Coverage   86.01%   86.02%           
=======================================
  Files         156      156           
  Lines      102857   102827   -30     
  Branches   102857   102827   -30     
=======================================
- Hits        88474    88453   -21     
+ Misses      11876    11865   -11     
- Partials     2507     2509    +2     
Flag Coverage Δ
tests 86.02% <85.05%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jkczyz jkczyz requested a review from wpaulino January 29, 2026 18:32
@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @jkczyz @wpaulino! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

1 similar comment
@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @jkczyz @wpaulino! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot
Copy link

🔔 2nd Reminder

Hey @jkczyz @wpaulino! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

// If this peer already has some channels, a new channel won't increase our number of peers
// with unfunded channels, so as long as we aren't over the maximum number of unfunded
// channels per-peer we can accept channels from a peer with existing ones.
if is_only_peer_channel && peers_without_funded_channels >= MAX_UNFUNDED_CHANNEL_PEERS {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed while running this test: https://github.com/elnosh/rust-lightning/blob/813c0146b3149c85111139fa4649a808a32e7217/lightning/src/ln/channel_open_tests.rs#L92-L110 that it would fail to accept the inbound channel if the number of peers without funded channels was == MAX_UNFUNDED_CHANNEL_PEERS but IIUC it should fail to accept it if the # of channels > MAX_UNFUNDED_CHANNEL_PEERS

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this code was unreachable before? Let's split the change into a separate commit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. It was reachable, just that the failing of new channels was off-by-one.

@elnosh elnosh force-pushed the manual-channel-acceptance branch from b1ee9e3 to 96719d6 Compare February 3, 2026 00:52
@jkczyz jkczyz removed their request for review February 3, 2026 17:12
@wpaulino
Copy link
Contributor

wpaulino commented Feb 4, 2026

This also needs a rebase

@elnosh elnosh force-pushed the manual-channel-acceptance branch from 96719d6 to daf61b3 Compare February 4, 2026 15:48
@elnosh
Copy link
Contributor Author

elnosh commented Feb 4, 2026

rebased and renamed channel config to default to anchors

@elnosh elnosh force-pushed the manual-channel-acceptance branch from daf61b3 to 927b6c1 Compare February 4, 2026 18:44
@wpaulino
Copy link
Contributor

wpaulino commented Feb 5, 2026

Feel free to squash

When accepting channels manually, it would
fail if the # of peers without funded channels
was == `MAX_UNFUNDED_CHANNEL_PEERS`, however,
it should fail if the # of peers > `MAX_UNFUNDED_CHANNEL_PEERS`.
Removes the `manually_accept_inbound_channels` config
option. In upcoming commit we will default to anchor
channels which requires users checking if they have
enough onchain funds to cover fees in case of a force
close. Hence, we move to always require users to
manually accept inbound channels.
Set `negotiate_anchors_zero_fee_htlc_tx` default
to true.
Now that anchor channels are the default,
rename `test_default_anchors_channel_config` to
`test_default_channel_config` and the
previous default to legacy.
@elnosh elnosh force-pushed the manual-channel-acceptance branch from 927b6c1 to 306eea7 Compare February 5, 2026 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Move to always-manually-accepting channels (and default anchors)

4 participants